<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    

    <input type="text" id="input1">
    
    <div>
        
    <button onClick="handleNoSelfSend()">除自己外发送</button>


    </div>
    <button onClick="handleSend()">内容发送</button>


</body>

<script src="/socket.io/socket.io.js"></script>
<script>
    let inputDom = document.querySelector('#input1')

    //
    function handleSend() {
        console.log(1111);
        let inputVal = inputDom.value
        socket.emit('c222', '测试客户端发布功能')
    }
    function handleNoSelfSend() {
        console.log('群组的其他成员能接收到信息。');
        let inputVal = inputDom.value
        socket.emit('c333', '兄嘚收到没？')

    }



    
    var socket = io();
    socket.emit('c1', 'hello')


    socket.on('c1', function (data) {
        console.log(data)
    })

    socket.on('c222', function (data) {
        console.log('客户端接收参数', data);
    })


    socket.on('c333', function (data) {
        console.log('333客户端接收参数', data);
    })
</script>
</html>